package org.test.client.ui.content.dashboard;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;

import javax.swing.JPanel;

import org.test.client.ui.ContentMain;
import org.test.client.ui.component.MyBasePanel;
import org.test.client.ui.component.label.TagLabel;
import org.test.client.ui.component.panel.TitlePanePanel;
import org.test.client.ui.util.VFlowLayout;

public class DashboardPanel extends MyBasePanel {

	public static final String PK = "DashBoard";
	
	private TitlePanePanel tpp = null;
	private TitlePanePanel tpp2 = null;
	
	public DashboardPanel(){}
	
	public DashboardPanel(ContentMain contentMain) {
		super(contentMain);
	}

	@Override
	public MyBasePanel doInit() {
		
		TagLabel tagLabel1 = new TagLabel(TagLabel.TYPE_BLUE, "fa-user","6","Total Number","507").doInit();
		TagLabel tagLabel2 = new TagLabel(TagLabel.TYPE_GREEN, "fa-star","4","Pro Members","228").doInit();
		TagLabel tagLabel3 = new TagLabel(TagLabel.TYPE_ORANGE, "fa-shopping-cart","$34","Sales","$13320").doInit();
		TagLabel tagLabel4 = new TagLabel(TagLabel.TYPE_RED, "fa-envelope","12","Messages","25").doInit();
		
		JPanel top = new JPanel(new GridLayout(1,4,5,5));
		top.add(tagLabel1);
		top.add(tagLabel2);
		top.add(tagLabel3);
		top.add(tagLabel4);
		
		
		tpp = new TitlePanePanel("Introduction", "fa-info-circle"); 
		tpp.doInit();
		tpp2 = new TitlePanePanel("Open Source", "fa-list-alt"); 
		tpp2.doInit();
		
		JPanel center = new JPanel();
//		BoxLayout boxLayout = new BoxLayout(center, BoxLayout.Y_AXIS);
//		center.setLayout(boxLayout);
	
		center.setLayout(new VFlowLayout());
		center.add(tpp);
		center.add(tpp2);
		
		tpp.setPreferredSize(new Dimension(0,250));
		tpp2.setPreferredSize(new Dimension(0,200));
		
		
		this.setLayout(new BorderLayout());
		this.add(top,BorderLayout.NORTH);
		this.add(center);
		
		return this;
	}
	
	@Override
	protected void paintComponent(Graphics arg0) {
		
		super.paintComponent(arg0);
	}

	@Override
	public String getPanelKey() {
		return PK;
	}
	
}
